So let's take a look at how we would achieve this in code. We'll start with the inputs. In particular, we'll be
using the keras layers API, to pick at the layers, and to understand
which ones we want to use, and which ones we
want to retrain. A copy of the
pretrained weights for the inception neural network
is saved at this URL. Think of this as a snapshot of the model after being trained. It's the parameters
that can then get loaded into the skeleton
of the model, to turn it back into
a trained model. So now if we want
to use inception, it's fortunate that keras has the model definition built in. So you instantiate that with the desired input shape
for your data, and specify that you don't want to use the built-in weights, but the snapshot that
you've just downloaded. The inception V3 has a
fully-connected layer at the top. So by setting
include_top to false, you're specifying that
you want to ignore this and get straight
to the convolutions. Now that I have my pretrained
model instantiated, I can iterate through
its layers and lock them, saying that they're not going to be trainable with this code. You can then print a summary
of your pretrained model with this code but be
prepared, it's huge. There's no way I can
fit it all in a slide, even if I use a two
point font like this. This is probably
less than 10 percent of the summary of the model. Try it in the notebook
for yourself.